package com.example.yangyinzhaixian.Fragemt;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.yangyinzhaixian.R;
import com.example.yangyinzhaixian.ShezhiActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class StudyFragment extends Fragment implements View.OnClickListener {

    //央音在线
    public static final String As_URL = "http://m.immedc.com/html5/yyapp/about.html";
    //服务协议
    public static final String Protocol_URL = "http://m.immedc.com/html5/yyapp/protocol.html";
    //版权声明
    public static final String copyright_URL = "http://m.immedc.com/html5/yyapp/copyright.html";
    //常见问题
    public static final String Question_URL = "http://m.immedc.com/html5/yyapp/commonQuestion.html";

    private View inflate;
    private Button study_btn_register;
    private Button study_btn_login;
    private Button study_text_regard;
    private Button study_text_server;
    private Button study_text_copyright;
    private Button study_text_cache;
    private Button study_text_issue;
    private Button study_text_update;
    private Button study_text_idea;
    private Intent intent;

    public StudyFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        inflate = inflater.inflate(R.layout.fragment_study, container, false);
        initView(inflate);
        intent = new Intent(getContext(), ShezhiActivity.class);
        return inflate;
    }

    private void initView(View inflate) {
        study_btn_register = (Button) inflate.findViewById(R.id.study_btn_register);
        study_btn_login = (Button) inflate.findViewById(R.id.study_btn_login);
        study_btn_register.setOnClickListener(this);
        study_btn_login.setOnClickListener(this);
        study_text_regard = (Button) inflate.findViewById(R.id.study_text_regard);
        study_text_regard.setOnClickListener(this);
        study_text_server = (Button) inflate.findViewById(R.id.study_text_server);
        study_text_server.setOnClickListener(this);
        study_text_copyright = (Button) inflate.findViewById(R.id.study_text_copyright);
        study_text_copyright.setOnClickListener(this);
        study_text_cache = (Button) inflate.findViewById(R.id.study_text_cache);
        study_text_cache.setOnClickListener(this);
        study_text_issue = (Button) inflate.findViewById(R.id.study_text_issue);
        study_text_issue.setOnClickListener(this);
        study_text_update = (Button) inflate.findViewById(R.id.study_text_update);
        study_text_update.setOnClickListener(this);
        study_text_idea = (Button) inflate.findViewById(R.id.study_text_idea);
        study_text_idea.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.study_btn_register:

                break;
            case R.id.study_btn_login:

                break;
            case R.id.study_text_regard:
                intent.putExtra("url",As_URL);
                intent.putExtra("text",study_text_regard.getText().toString());
                startActivity(intent);
                break;
            case R.id.study_text_server:
                intent.putExtra("url",Protocol_URL);
                intent.putExtra("text",study_text_server.getText().toString());
                startActivity(intent);
                break;
            case R.id.study_text_copyright:
                intent.putExtra("url",copyright_URL);
                intent.putExtra("text",study_text_copyright.getText().toString());
                startActivity(intent);
                break;
            case R.id.study_text_cache:
                break;
            case R.id.study_text_issue:
                intent.putExtra("url",Question_URL);
                intent.putExtra("text",study_text_issue.getText().toString());
                startActivity(intent);
                break;
            case R.id.study_text_update:
                break;
            case R.id.study_text_idea:
                break;
        }
    }
}
